﻿//-----------------------------------------------------------------------
// <copyright file="Copyright.cs" author="Michael Herndon">
//     Copyright (c) Company.  All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace Amplify.CodeDom
{
	using System;
	using System.CodeDom;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;

	public static partial class Mixin
	{
		public static CodeMemberField AddField(this CodeTypeMemberCollection unit, string type, string name)
		{
			CodeMemberField  obj =	new CodeMemberField(type, name);
			obj.Attributes = MemberAttributes.Private;
			unit.Add(obj);
			return obj;
		}

		public static CodeMemberProperty AddProperty(this CodeTypeMemberCollection unit, string type, string propertyName)
		{
			CodeMemberProperty obj = new CodeMemberProperty();
			obj.Type = new CodeTypeReference(type);
			obj.Name = propertyName;
			unit.Add(obj);
			return obj;
		}

		public static CodeMemberProperty AddCommonProperty(this CodeTypeMemberCollection unit, string type, string propertyName)
		{ 
			CodeMemberProperty obj = new CodeMemberProperty();
			obj.Name = propertyName;
			obj.Type = new CodeTypeReference(type);
			obj.GetStatements.Add(Declare.Return(This.Field(propertyName.ToFieldName())));
			obj.SetStatements.Add(Assign.This.Field(propertyName.ToFieldName()).ToSetValue());
			obj.HasGet = true;
			obj.HasSet = true;
			obj.Attributes = MemberAttributes.Public;
			unit.Add(obj);
			return unit;
		}


	}

	public class MemberCollection
	{
	}
}
